label propagation.tex (967B)
1 \begin{algorithmic} 2 \Function{Label Propagation}{} 3 \FunctionInputs{} \(\dataSet_\relationSet\) labeled dataset 4 \FunctionInputs*{} \(\dataSet\) unlabeled dataset 5 \FunctionOutput{} \(\vctr{\hat{r}}\) relation predictions 6 \State 7 \LComment{Initialization} 8 \State \(\mtrx{T}\gets \text{computed using Equation~\ref{eq:relation extraction:label propagation transition}}\) 9 \State \hphantom{\(T\gets\)} from \(\dataSet_\relationSet\) and \(\dataSet\) 10 \State \(\mtrx{Y} \gets \text{random stochastic matrix}\) 11 \ForAll{\((s_i, \vctr{e}_i, r_i)\in\dataSet_\relationSet\)} 12 \State \(y_{ij} \gets \delta_{j,r_i}\) 13 \EndFor 14 \LComment{Training} 15 \Loop 16 \State \(\mtrx{Y} \gets \mtrx{T}\mtrx{Y}\) 17 \ForAll{\((s_i, \vctr{e}_i, r_i)\in\dataSet_\relationSet\)} 18 \State \(y_{ij} \gets \delta_{j,r_i}\) 19 \EndFor 20 \EndLoop 21 \vspace{1mm} 22 \State \(\hat{r}_i \gets \argmax_j y_{ij}\) 23 \State \Output \(\vctr{\hat{r}}\) 24 \EndFunction 25 \end{algorithmic}